
import socket, sys, threading, time, os
 

   
def ScanPort(port):
   
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.settimeout(2)
    try:
        s.connect((ip,port))
        print port
        s.close()
    except socket.error:
       
        s.close()
       
   
print('Entrez adresse IP ou nom de domaine')
#ip=input()
ip=sys.argv[1]

portdebut=int(input('Entrer port de debut: \n'))

portfin=int(input('Entrer port de fin\n'))


while (portdebut != portfin):
#    a = threading.Thread(None, ScanPort, None,(portdebut,))
    
    portdebut= portdebut + 1
    ScanPort(portdebut)
#    a.start()
